
var itcast = {
    getRouterName: (str) => {
        let index = str.indexOf('?')
        let routerName = ''
        if (index == -1) { // 说明没有参数
            routerName = str.substring(str.lastIndexOf('/') + 1)
        } else {
            routerName = str.substring(str.lastIndexOf('/') + 1, str.indexOf('?'))
        }
        return routerName
    },
    getParameter: (str) => {
        let obj = {}
        str = str.substring(1);
        let temp = str.split('&');
        for (let i = 0; i < temp.length; i++) {
           let arr=temp[i].split('=');
           obj[arr[0]]=arr[1];
        }
        return obj;
    }
}